package com.hp.bon.sgw.wh.channel.outside;

import com.alipay.api.internal.util.StringUtils;
import com.hp.bon.sgw.wh.channel.common.BizConsts;
import com.hp.bon.sgw.wh.channel.common.BizParam;
import com.hp.bon.sgw.wh.service.UserResourceConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class OutApiConfigLoader {

    private static final Logger _log = LoggerFactory.getLogger(OutApiConfigLoader.class);
    
    public BizParam doLoader(BizParam bizParam) {

    	String capability = bizParam.getParamString(BizConsts.KEY_API_CAPABILITY);

    	String configKey = null;
        if ("QueryStopNet.HB".equals(capability)) {
        	configKey = capability;
        } else if("QueryBlackOwe.HB".equals(capability)) {
        	configKey = capability;
        } else if("PayBlackOwe.HB".equals(capability)) {
        	configKey = capability;
        }else if("RechargeExtract.BestPay".equals(capability)) {
            configKey = "JfzsRechargeInfoSave";
        }
        
        String accountApiUrl = UserResourceConfigService.getValue(configKey);
        if (StringUtils.isEmpty(accountApiUrl)) {
            _log.error("none accountApiUrl of {}", configKey);
        } else {
            bizParam.setParam(BizConsts.KEY_ACCOUNT_API_URL, accountApiUrl);
        }
        
        return bizParam;
    }

}
